package com.cg.managesystem.service.impl;

import com.cg.managesystem.entity.LoginTicket;
import com.cg.managesystem.mapper.LoginTicketMapper;
import com.cg.managesystem.service.LoginTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Create tao on 2019/8/13
 */
@Service
public class LoginTicketImpl implements LoginTicketService {

    @Autowired
    LoginTicketMapper loginTicketMapper;

    @Override
    public int addLoginTicket(LoginTicket loginTicket) {
        return loginTicketMapper.addLoginTicket(loginTicket);
    }

    @Override
    public boolean isLoginTicket(int id) {
        if (loginTicketMapper.isLoginTicket(id) != null) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int updateLoginTicket(Date expired, String ticket, int id) {
        return loginTicketMapper.updateLoginTicket(id, expired, ticket);
    }
}
